<!DOCTYPE HTML>
<!--[if (gt IE 9)|!(IE)]><!--><html><!--<![endif]-->
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="applicable-device" content="pc">
    <meta name="baidu-site-verification" content="Qu9OzfSVVJ" />
    <title>糖半甜-确认订单</title>
    <link rel="shortcut icon" type="image/vnd.microsoft.icon" href="/static/img/favicon_1.ico">
    <link rel="icon" href="/static/img/favicon_1.ico" size="16x16 32x32">
    <link rel="stylesheet" href="__TMPL__/public/shop/sss/preview_981fd62e.css" />
</head>
<body>
<div class="wrapper">
    <div class="page-wrap">
        <div class="inner-wrap">
            <div class="clearfix order-confirm" id="j-order-confirm">
                <div class="order-info-wrapper j-order-info-wrapper clearfix">
                    <div class="fl address">
                        <table class="standard-table dishes-table">
                            <thead >
                            <tr class="bot-border">
                                <th class="left" width="240"><div class="th-inner align-left">订单号</div></th>
                                <th class="right" colspan="2"><div class="th-inner align-right orderid" ></div></th>
                            </tr>
                            </thead>
                            <tbody id="content">
                            </tbody>
                        </table>
                        <div class="ticket-age"></div>

                    </div>
                    <div class="dishes">

                        <div class="pay-area">
                            <div class="tips ct-black">
                                <a class="s-btn  " id="confirmOrder" ><span class="s-btn ">详情</span></a>
                            </div>
                        </div>
                        <div class="pay-area">
                            <div class="tips ct-black">
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>
<script src="__TMPL__/public/shop/js/jquery.js"></script>

</body>
<script>
    var order=parent.$('.orderid').html();
    $('.orderid').html(order);
    /*
    * 详情
    * */
    $('#confirmOrder').click(function(){
        var order=$('.orderid').html();
        $.post("{:url('orderpay/amend')}",{order:order},function (data) {
           var date=data.msg;
           var src='';
           $.each(date,function (k,val) {
               var k=k+1;
               src +='<tr class="" >' +
                   '<td class="left">' +
                   '<div class="td-inner align-left" >'+
                   '<div > '+
                    k+
                   '</div>'+
                   '<div class="dish-sku">'+
                    val.g_goodsname+
                   '</div>' +
                   '</div>'+
                   '</td>' +
                   ' <td class="right " colspan="2">' +
                   '<div class="td-inner ">'+
                    val.price+
                   '</div>' +
                   '<div class="td-inner align-right Integral"><input type="hidden" class="oid" value="'+val.id+'">兑换'+
                   '</div>'+
                   '</td>' +
                   ' </tr>'
               $('#content').html(src);
           })
        },'json')
    })
    /*
    * 兑换
    * */
    var index = parent.layer.getFrameIndex(window.name); //获取当前窗体索引
    $('#content').on('click','.Integral',function () {
        var  oid=$(this).children('.oid').val();
        $.post("{:url('orderpay/Integral')}",{oid:oid},function (date) {
            var data=date.msg.num;
            if(data == 1 )
            {
                parent.$('#s_pay').val(date.msg.con);
                alert('兑换完成');
                //parent.layer.close(index); //执行关闭
            }else{
                alert(date.msg.con);
            }
        },'json')
    })
</script>
</html>
